#include <bits/stdc++.h>

using namespace std;

// 找到缺失的数字
// 测试链接 : https://leetcode.cn/problems/missing-number/

class Solution 
{
public:
    int missingNumber(vector<int>& nums) 
    {
        int eorAll = 0, eorHas = 0;
        for(int i = 0; i < nums.size(); ++i)
        {
            eorAll ^= i;
            eorHas ^= nums[i];
        }
        eorAll ^= nums.size();
        return eorAll ^ eorHas;
    }
};